package sean.org;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;

@Service
public class AwareService implements BeanNameAware,ResourceLoaderAware{

	private String beanName;
	private ResourceLoader loader;
	

	@Override
	public void setBeanName(String name) {
		this.beanName=name;
	}


	@Override
	public void setResourceLoader(ResourceLoader resourceLoader) {
		this.loader=resourceLoader;
	}

	public void outputResult(){
		System.out.println("bean的名称："+beanName);
		Resource resource = loader.getResource("sean/org/test.txt");
		try {
			System.out.println(resource.getFilename());
		} catch (Exception e) {
		}
	}
}
